const express = require('express')

const userValidator = require('../validator/user')
const userCtrl = require('../controller/user')
const auth = require('../middleware/auth')

const router = express.Router()

// 用户注册
router.post('/register', userValidator.register, userCtrl.register)

// 用户登录
router.post('/login', userValidator.login, userCtrl.login)

// 用户查询
router.get('/:username', auth, userCtrl.getCurrentUser)

module.exports = router
